#include <kanzi/core.ui/graphics2d/brush_renderer.hpp>
Public Types | |
enum | RenderMode { RenderModeNone, RenderModeContent, RenderModeNoContent } |
Enum signifying currently selected render mode. More... | |
Public Member Functions | |
MaterialSharedPtr | acquireErrorMaterial () |
Acquires an error material for rendering. More... | |
void | attachMaterial (MaterialSharedPtr material) |
Attaches a custom material. More... | |
void | bind (Renderer3D &renderer, PropertyObject *object) |
Binds a brush renderer for rendering. More... | |
void | bind (Renderer3D &renderer) |
Bind brush renderer for rendering. More... | |
void | draw (Renderer &renderer, const Geometry &quad, const Matrix4x4 &transform) |
Draw a brush using given quad. More... | |
void | draw (Renderer &renderer, const Geometry &quad, const Matrix3x3 &transform) |
Overload for draw a brush using given quad. More... | |
int | getBlendModeValue () |
Gets the last used blend mode value. More... | |
Brush * | getBrush () const |
Gets the brush for which Kanzi created this brush renderer. More... | |
TextureSharedPtr | getContentTexture () const |
Access content texture. More... | |
MaterialSharedPtr | getMaterial () |
Gets the currently set material for the renderer. More... | |
Node * | getNode () const |
Gets the attached node. More... | |
unsigned int | getPropertyChangeCounter () const |
Gets the brush property change counter. More... | |
RenderMode | getRenderMode () const |
Get currently selected render mode. More... | |
float | getRenderOpacity () const |
Access opacity. More... | |
GlRenderState & | getRenderState () |
Gets the internal render state. More... | |
bool | hasRenderMode () const |
Indicates whether a valid render mode is selected. More... | |
void | invalidateRenderValues () |
Invalidates all render values. More... | |
void | restoreResources () |
Restore resources after sleep. More... | |
void | setContentTexture (TextureSharedPtr texture) |
Set a content texture. More... | |
void | setRenderOpacity (float opacity) |
Set opacity to use for next attach. More... | |
void | updateRender (optional< int > blendMode, bool translucencyHint) |
Called from Node2D::updateRender(). More... | |
virtual | ~BrushRenderer ()=default |
Destructor. More... | |
Protected Member Functions | |
virtual void | bindOverride (Renderer3D &renderer, PropertyObject *object) |
BrushRenderer-specific bind implementation. More... | |
BrushRenderer (Brush *brush, Node *node) | |
Constructor. More... | |
virtual void | drawOverride (Renderer &renderer, const Geometry &geometry, const Matrix4x4 &transform)=0 |
Draw geometry using the brush. More... | |
virtual bool | isChangeCounterSame () |
Checks whether the property change counter matches that of the brush. More... | |
virtual void | restoreResourcesOverride () |
BrushRenderer-specific restore resources implementation. More... | |
virtual void | setContentTextureOverride (TextureSharedPtr texture) |
BrushRenderer-specific update of the content texture. More... | |
void | setRenderMode (RenderMode selection) |
Set render mode. More... | |
virtual void | updateChangeCounter () |
Updates property change counter to match the counter value from brush. More... | |
virtual void | updateRenderOverride (optional< int > blendMode, bool translucencyHint)=0 |
BrushRenderer-specific opacity override implementation. More... | |
Protected Attributes | |
Brush * | m_brush |
Brush attached to. More... | |
unsigned int | m_brushPropertyChangeCounter |
Property change counter to track brush. More... | |
TextureSharedPtr | m_contentTexture |
Content texture provided to the brush renderer from outside. For example, from Node2D. More... | |
GlRenderState::HandleType | m_contentTextureHandle |
Render value handle. More... | |
Node * | m_node |
Node attached to. More... | |
RenderMode | m_renderMode |
Currently used render mode (or none if not selected). More... | |
float | m_renderOpacity |
Opacity to issue on attach. More... | |
GlRenderState::HandleType | m_renderOpacityHandle |
Render value handle. More... | |
GlRenderState | m_renderState |
Contained render state. More... | |
GlRenderValueBinding | m_renderValueBinding |
Property binding handler. More... | |
Brush renderer class.
Just an interface, actual rendering will be implemented by specialized brush renderers.
|
virtualdefault |
Destructor.
Constructor.
node | The node to which to attach. |
brush | The brush to which to attach. |
|
inline |
Called from Node2D::updateRender().
Prepares a brush for rendering. Call this function when the brush material or attached nodes have changed. Unlike bind(), updateRender() does not need to be called every frame before draw().
blendMode | Optional blend mode override. |
translucencyHint | Additional hint to use translucent rendering. |
blendMode
parameter. forceOpaque
parameter.
|
inline |
Binds a brush renderer for rendering.
You must call this function before you call draw().
renderer | The renderer to use. |
object | The object from which to fetch properties. |
|
inline |
void kanzi::BrushRenderer::draw | ( | Renderer & | renderer, |
const Geometry & | quad, | ||
const Matrix4x4 & | transform | ||
) |
Draw a brush using given quad.
renderer | Renderer to use. |
quad | Quad to draw. |
transform | The transform as a 4x4 matrix to use. |
|
inline |
Overload for draw a brush using given quad.
renderer | Renderer to use. |
quad | Quad to draw. |
transform | The transform as a 3x3 matrix to use. |
|
inline |
Restore resources after sleep.
|
inline |
Gets the brush for which Kanzi created this brush renderer.
|
inline |
Gets the internal render state.
|
inline |
Invalidates all render values.
MaterialSharedPtr kanzi::BrushRenderer::acquireErrorMaterial | ( | ) |
Acquires an error material for rendering.
Kanzi uses this function internally when the assigned material is not applicable.
|
inline |
Gets the brush property change counter.
|
inline |
Access opacity.
|
inline |
Set opacity to use for next attach.
opacity | New render opacity. |
|
inline |
Access content texture.
|
inline |
Set a content texture.
texture | New render texture. |
|
inline |
Get currently selected render mode.
|
inline |
Indicates whether a valid render mode is selected.
MaterialSharedPtr kanzi::BrushRenderer::getMaterial | ( | ) |
Gets the currently set material for the renderer.
int kanzi::BrushRenderer::getBlendModeValue | ( | ) |
Gets the last used blend mode value.
This function is intended for tests.
void kanzi::BrushRenderer::attachMaterial | ( | MaterialSharedPtr | material | ) |
Attaches a custom material.
This function internally calls BrushRenderer::attachMaterial().
material | The material to attach. |
|
protectedpure virtual |
Draw geometry using the brush.
To be implemented by specific brush implementations.
renderer | Renderer to use. |
geometry | Quad to draw. |
transform | Transform to use. |
Implemented in kanzi::TextureBrushRenderer, kanzi::ColorBrushRenderer, kanzi::MaterialBrushRenderer, and kanzi::ContentBrushRenderer.
|
protectedvirtual |
BrushRenderer-specific bind implementation.
renderer | Renderer to use. |
object | The object from which to fetch properties. |
object
.
|
protectedpure virtual |
BrushRenderer-specific opacity override implementation.
blendMode | Optional blend mode override. |
translucencyHint | Additional hint to use translucent rendering. |
blendMode
parameter. forceOpaque
parameter. Implemented in kanzi::TextureBrushRenderer, kanzi::ColorBrushRenderer, kanzi::MaterialBrushRenderer, and kanzi::ContentBrushRenderer.
|
protectedvirtual |
BrushRenderer-specific restore resources implementation.
|
inlineprotectedvirtual |
BrushRenderer-specific update of the content texture.
texture | New renderer texture. |
Reimplemented in kanzi::ColorBrushRenderer.
|
inlineprotected |
Set render mode.
selection | New render mode selection. |
|
protectedvirtual |
Checks whether the property change counter matches that of the brush.
Reimplemented in kanzi::MaterialBrushRenderer.
|
protectedvirtual |
Updates property change counter to match the counter value from brush.
Reimplemented in kanzi::MaterialBrushRenderer.
|
protected |
Brush attached to.
|
protected |
Currently used render mode (or none if not selected).
|
protected |
Contained render state.
|
protected |
Property binding handler.
|
protected |
Render value handle.
|
protected |
Render value handle.
|
protected |
Content texture provided to the brush renderer from outside. For example, from Node2D.
|
protected |
Opacity to issue on attach.
|
protected |
Property change counter to track brush.